package com.lin.reggie.mapper;

import com.lin.reggie.entity.Category;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CategoryMapper {

    //添加菜品分类
    void save(Category category);

    //分类菜单分页查询
    List<Category>findAll();

    //删除菜单分类
    void deleteById(Long id);

    //根据name查询对应类别的数量，排除当前自己的类别
    Integer selectByNameCount(Category category);

    //修改类别
    Integer update(Category category);

    //查询所有类别，按照sort字段排序
    @Select("select * from category order by sort asc")
    List<Category> findAl2();

    //根据类型查询类别列表数据
    List<Category>findAllByType(@Param("type") Integer type);


    Category findById(Long id);

}
